<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-3.2.1.min.js"></script>
    <script>
        $(function () {
            $('#btn').on('click',function () {
               var num = $('input').val();
               if ( (/^[1-9A-Za-z]\w{6,8}[a-zA-Z]$/.test(num)) ) {
                   alert(true);
               } else {
                   alert(false);
               }
            })
        })
    </script>
</head>
<body>
<input type="text" value=""/>
<button id="btn">click</button>
</body>
</html>